<html>
<head><meta charset="utf-8"><title>Initializing an aggregate field-by-field · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing.20an.20aggregate.20field-by-field.html">Initializing an aggregate field-by-field</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="158511144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing%20an%20aggregate%20field-by-field/near/158511144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing.20an.20aggregate.20field-by-field.html#158511144">(Feb 14 2019 at 08:13)</a>:</h4>
<p>At the all-hands, we talked about aggregate initializers vs. initializing an aggregate field-by-field, and then having some kind of "marker instruction" saying "now all fields have been initialized, go get it". I was doubtful about what this would even mean in terms of semantics, but now we have an example: I think this would help with <a href="https://github.com/solson/miri/issues/633" target="_blank" title="https://github.com/solson/miri/issues/633">https://github.com/solson/miri/issues/633</a>.<br>
Cc <span class="user-mention" data-user-id="119009">@eddyb</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="158519347"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing%20an%20aggregate%20field-by-field/near/158519347" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing.20an.20aggregate.20field-by-field.html#158519347">(Feb 14 2019 at 10:39)</a>:</h4>
<p>interesting, so we would want to even keep it in</p>



<a name="158519363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing%20an%20aggregate%20field-by-field/near/158519363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing.20an.20aggregate.20field-by-field.html#158519363">(Feb 14 2019 at 10:39)</a>:</h4>
<p>instead of it being removed like some borrowck-only constructs are</p>



<a name="158521395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing%20an%20aggregate%20field-by-field/near/158521395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/Initializing.20an.20aggregate.20field-by-field.html#158521395">(Feb 14 2019 at 11:17)</a>:</h4>
<p>yeah this seems like it could help tell the optimizer when it can rely on certain invariants</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>